<?php 
use Common\Model\Cate;
$cateModel=new Cate;
//显示头部导航
$cateData=$cateModel->where("pid=0")->orderBy('sort','DESC')->limit(6)->get();
//显示侧导航
$nav=$cateModel->where("pid=0")->orderBy('sort','DESC')->limit(8)->get();
foreach($nav as $k=>$v){
$cid=$nav[$k]['cid'];
	$nav[$k]['value']=$cateModel->where("pid={$cid}")->limit(4)->get();
}
//显示网站导航
$navData=$cateModel->where("pid=0")->orderBy('sort','DESC')->limit(8)->get();
 ?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="./Public/home/css/index.css"/>
		<link rel="stylesheet" type="text/css" href="./Public/home/css/list.css"/>
		<link rel="stylesheet" type="text/css" href="./Public/home/css/header.css"/>
		<script src="./Public/home/js/jquery-1.7.2.min.js"></script>
		<script src="./Public/home/js/style.js"></script>
	</head>
	<body>
	<!--header-->
	<div id="header">
		<div class="header"> 
			<div class="headerTop">
				<div class="headerLeft">
					<h1>
						<a href="{{U('Index/index')}}"><img src="./Public/home/images/logo1_cc09ff8.png"/></a>
					</h1>
				</div>
				<div class="headerRight">
					<ul class="header-car">
						<li class="shop-car">
							<a href="{{U('Cart/index')}}">购物车({{if value="isset($_SESSION['cart'])"}}{{$_SESSION['cart']['total_rows']}}{{else}} 0{{endif}})</a>
							<!--<div class="car-box">
								{{if value="isset($_SESSION['cart'])"}}
								<div class="shop-car-empty">
									{{foreach from="$_SESSION['cart']['goods']" value="$v"}}
									<a href="{{U('Content/index',['gid'=>$v['id']])}}">
										<img src="{{$v['pic']}}" />
										<p>
											<span>{{$v['name']}}</span><br />
											<span>{{implode(',', $v['options'])}}({{$v['num']}}件)</span>
										</p>
									</a>
									
									{{endforeach}}
								</div>
								{{else}}
								<div class="shop-car-empty">购物车中还没有商品,赶紧选购吧!</div>
								{{endif}}
							</div>-->
						</li>
					</ul>
					<!--搜索-->
					<div class="select">
						<form action="{{U('List/index')}}" method="post">
							<input type="text" name="select" class="select-box" />
							<input type="submit" value="So索" class="select-btn"/>
						</form>
					</div>
					<ul class="navbar">
						<li><a href="{{U('Index/index')}}" >首页</a></li>
						{{foreach from="$cateData" value="$c"}}
						<li><a href="{{U('List/index',['cid'=>$c['cid']])}}" 
							{{if value="isset($_GET['cid'])"}}
							{{if value="$_GET['cid'] eq $c['cid']"}} class="hover" {{endif}}
							{{endif}}
							>{{$c['cname']}}</a></li>
						{{endforeach}}
					</ul>
				</div>
			</div>
			<div class="header-bottom">
				<div class="header-bottom-box">
					<div class="bottom-left-hover">
						<div class="header-bottom-left">全部商品分类</div>
						<ul class="nav-list">
						{{foreach from="$nav" value="$n"}}
							<li>
								<a href="{{U('List/index',['cid'=>$n['cid']])}}" class="nav-list-title">{{$n['cname']}}</a>
								{{foreach from="$n['value']" value="$v"}}
								<a href="{{U('List/index',['cid'=>$v['cid']])}}">{{$v['cname']}}</a>
								{{endforeach}}
							</li>
						{{endforeach}}
					</ul>
					</div>
					<ul class="header-bottom-right">
						<li class="li-nav">
							<span style="padiving-left: 15px;">网站导航</span>
							<div class="all-list">
								{{foreach from="$navData" value="$v"}}
								<div><a href="{{U('List/index',['cid'=>$v['cid']])}}">{{$v['cname']}}</a></div>
								{{endforeach}}
							</div>
						</li>
						{{if value="isset($_SESSION['nickuser'])"}}
						<li>
							<a href="{{U('Presonal/index')}}">{{$_SESSION['nickuser']['nickname']}}</a>
							<a href="{{U('Member/del')}}">退出登录</a>
							
						</li>
						{{else}}
						<li>
							<a href="{{U('Member/index')}}">登录</a>
							<a href="{{U('Member/reg')}}">注册</a>
							<!--<a href="">忘记密码？</a>-->
						</li>
						{{endif}}
						<li class="order"><a href="{{U('Presonal/order')}}">我的订单</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!--/header-->